#include "StdAfx.h"
#include "debughandler.h"

namespace gloox
{
LogHandler* DebugHandler::m_logHandler = NULL;
DebugHandler::DebugHandler(void)
{
}

DebugHandler::~DebugHandler(void)
{
}


LogHandler* DebugHandler::logHandler()
{
	if (m_logHandler == NULL)
	{
		m_logHandler = new DebugHandler();
	}

	return m_logHandler;
}

void DebugHandler::deleteHanlder()
{
	if (m_logHandler != NULL)
	{
		delete m_logHandler;
		m_logHandler = NULL;
	}
}

void DebugHandler::handleLog(LogLevel level, LogArea area, const std::string& message)
{
	char szMsg[4096];
	sprintf_s(szMsg, 4096, "LogLevel:%d, LogArea:%d:%s\r\n", level, area, message.c_str());
	OutputDebugString(szMsg);
}

}